package connection.commands;

import java.io.IOException;
import java.io.ObjectOutputStream;

/** @author Mihail A. Muhin */
//TODO: is it right - to initialize fields with refs, how to  clone them correctly
public class BaseCommand {
  public void write(ObjectOutputStream oos) {
    writeClassName(oos);
  }

  public void writeClassName(ObjectOutputStream oos) {
    String full_name = this.getClass().getName();
    String name = full_name.substring(full_name.lastIndexOf(".") + 1, full_name.length());
    try {
      oos.writeObject(name);
    } catch (IOException e) {

    }
  }
}
